#include <iostream>
#include <vector>
#include <unordered_map>
#include <vector>
#include <sstream>
#include <set>

void permu(std::vector<std::vector<char>> &c_lists, int idx, std::vector<std::vector<char>> &result_list, std::vector<char> &curr_vec)
{
    if (idx == c_lists.size())
    {
        result_list.push_back(curr_vec);
        return;
    }

    for (int j = 0; j < c_lists[idx].size(); j++)
    {
        curr_vec.push_back(c_lists[idx][j]);
        permu(c_lists, idx + 1, result_list, curr_vec);
        curr_vec.pop_back();
    }
}

int main()
{
    std::unordered_map<int, std::vector<char>> link_map;
    link_map[0] = {'a', 'b', 'c'};
    link_map[1] = {'d', 'e', 'f'};
    link_map[2] = {'g', 'h', 'i'};
    link_map[3] = {'j', 'k', 'l'};
    link_map[4] = {'m', 'n', 'o'};
    link_map[5] = {'p', 'q', 'r'};
    link_map[6] = {'s', 't'};
    link_map[7] = {'u', 'v'};
    link_map[8] = {'w', 'x'};
    link_map[9] = {'y', 'z'};

    std::vector<int> nums;
    std::string num_str;
    std::getline(std::cin, num_str);
    std::istringstream iss(num_str);
    int n;
    while (iss >> n)
    {
        nums.push_back(n);
    }

    std::vector<std::vector<char>> c_lists;
    for (int i = 0; i < nums.size(); i++)
    {
        c_lists.push_back(link_map[nums[i]]);
    }

    std::vector<char> c_vec;
    std::string c_str;
    std::getline(std::cin, c_str);
    std::istringstream css(c_str);
    char c;
    while (css >> c)
    {
        c_vec.push_back(c);
    }

    int indx = 0;
    std::vector<std::vector<char>> result_list;
    std::vector<char> curr_vec;
    permu(c_lists, indx, result_list, curr_vec);

    std::vector<std::vector<char>> filter_list;
    for (int i = 0; i < result_list.size(); i++)
    {
        std::set<char> c_set(result_list[i].begin(), result_list[i].end());
        bool find = true;
        for (int j = 0; j < c_vec.size(); j++)
        {
            if (c_set.count(c_vec[j]) == 0)
            {
                find = false;
                break;
            }
        }
        if (!find)
        {
            // filter_list.push_back(result_list[i]);
            for (int k = 0; k < result_list[i].size(); k++)
            {
                std::cout << result_list[i][k];
            }
            std::cout << ",";
        }
    }
    std::cout << std::endl;

    return 0;
}